﻿@model IEnumerable<WD.Db.Contract.Base_CodeData>

@{
    ViewBag.Title = "WD.Db.Contract.Model.Base_CodeData_Index";
    Layout = "~/Views/Shared/_LayoutIndex.cshtml";
    int i = 0;
}
@section Style
{
    <style>
        /*.table tbody > tr > td:first-child {font-size: 1.125em;font-weight: 300; }*/
    </style>
}

@section Script
{
    <script>
        var id = "Base_CodeData";

        //新增按钮配置信息（弹框）
        var option_add = {
            id: id,
            title: "新增数据字典",
            yesfn: function () {
                //AJAX加载过渡动画
                DialogLoading({ id: id }, true);
                //TODO AJAX保存事件开始
                $("#Base_CodeData_mainForm").PostForm({
                    vfn: function () { return true; },
                    success: function (data) {
                        msgsuc(data);
                        ReloadTab();
                        CloseDialog(id);
                    },
                    error: function (data) {
                        msgerr(data);
                    },
                    complete: DialogLoading({ id: id }, false)
                });

                //TODO AJAX保存事件结束
            },
            yestxt: "保存"
        };


        var id2 = "option_ztree";
        //新增按钮配置信息（弹框）
        var option_ztree = {
            id: id2,
            title: "演示ZTREE",
            yesfn: function () {
                //AJAX加载过渡动画
                DialogLoading({ id: id2 }, true);
                //TODO AJAX保存事件开始


                //隐藏AJAX加载过渡动画
                DialogLoading({ id: id2 }, false);
                //关闭窗口
                CloseDialog(id2);

                //TODO AJAX保存事件结束
            },
            yestxt: "保存"
        };
    </script>

}

@section ToolbarArea{
    <a href="@Url.Action("Create")" target="edit" data-option='option_add'  class="btn pull-left">
        <i class="fa fa-plus"></i>新增
    </a>
}


@section SearchArea{

}

@section MainTable{
    <table class="table">
        <thead>
            <tr>
                <th class="text-left"><span>序号</span></th>
                <th><a href="#" role="sort" data-field="CodeID"><span>字典编号</span></a></th>
                <th><a href="#" role="sort" data-field="CodeName"><span>字典名称</span></a></th>
                <th><a href="#" role="sort" data-field="CodeType"><span>父级字典</span></a></th>
                <th><a href="#" role="sort" data-field="Sort"><span>排序</span></a></th>
                <th><a href="#" role="sort" data-field="EditUser"><span>编辑人</span></a></th>
                <th><a href="#" role="sort" data-field="EditDate"><span>编辑时间</span></a></th>
                <th><a href="#" role="sort" data-field="CreateTime"><span>创建时间</span></a></th>
                <th><a href="#" role="sort" data-field="IsDeleted"><span>状态</span></a></th>
                <th class="text-right"><span>操作</span></th>


            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                i++;
                <tr>
                    <td>
                        @i
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.CodeID)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.CodeName)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Base_CodeData_Parent.CodeName)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Sort)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.EditUser)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.EditDate)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.CreateTime)
                    </td>
                    <td>
                        @if (item.IsDeleted)
                        {
                            <span class="label label-danger label-large">已删除</span>
                        }
                    </td>
                    <td class="text-right">
                        <a href="@Url.Action("Edit", new { id = item.ID })" class="table-link" target="edit" data-option='option_add' >
                            <span class="fa-stack">
                                <i class="fa fa-square fa-stack-2x"></i>
                                <i class="fa fa-pencil fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>

                        <a href="@Url.Action("Deleted", new { ids = item.ID })" class="table-link danger" target="ajax" data-reload="true">
                            <span class="fa-stack">
                                <i class="fa fa-square fa-stack-2x"></i>
                                <i class="fa fa-trash-o fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>

                    </td>
                </tr>
            }
        </tbody>
    </table>
}


